package main

import (
	"fmt"
	"time"
)

func main() {
	var chTick <-chan time.Time = time.Tick(1000 * time.Millisecond)
	var chAfter <-chan time.Time = time.After(5000 * time.Millisecond)

	for {
		select {
			case <-chTick:
				fmt.Println("tick")
			case <-chAfter:
				fmt.Println("BOOM")
				return
			default:
				fmt.Println(".")
				time.Sleep(500 * time.Millisecond)
		}
	}
}
